home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 387 < prev    next >
Internet Message Format  |  1996-08-06  |  3KB

  1. Path: newsfeed.direct.ca!usenet
  2. From: qjackson@direct.ca
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.std.c
  4. Subject: Re: Problem: Parsing Algorithms????????
  5. Date: Thu, 15 Feb 1996 00:23:18 GMT
  6. Organization: Parsepolis Software
  7. Message-ID: <4ftud4$gnt@aphex.direct.ca>
  8. References: <4535421196525ntc@compuserve.com>
  9. Reply-To: qjackson@direct.ca
  10. NNTP-Posting-Host: 204.174.249.1
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. Matthew Dougherty <76477.1267@compuserve.com> wrote:
  14.  
  15. >I am writing an ANSI C language program to Parse name, address, phone,
  16. >email, and a couple of other fields from text resumes.  The idea is to
  17. >have resumes that are emailed to be automatically entered into a database.
  18.  
  19. Probably the closest thing you're going to find in the C world is lex,
  20. awk, sed, or perl.  Lex would be the most easily integrated, but it
  21. suffers from the fact that it is static in nature (ie. search patterns
  22. cannot modify themselves once they have been compiled by lex into C
  23. code).
  24.  
  25. >For street address there are key words like APT. ST. etc.
  26. >ZipCodes are easy to find and prove because there are limited
  27. >possibilities for states or state codes, 
  28.  
  29. >Phone numbers are easy to find.
  30.  
  31. >Names are difficult.  It's basically positional.  It can be different
  32. >every time.  The name can be alone on a line or on the same line as phone
  33. >or  something.
  34.  
  35. >Ideas are appreciated.
  36.  
  37. I am currently working on a <standard> C++ port of LPM, an interpreted
  38. language for pattern matching that I originally implemented in a
  39. non-C/C++ language.  It will include C wrappers to allow it to be
  40. called from ANSI C code.  The port is ~40% complete now.
  41.  
  42. LPM allows you to scan a string for patterns rather than string
  43. literals.  For instance, to find a legal North American phone number
  44. in a given target string, one would use the rule:
  45.  
  46.     [@(
  47.         [@'('$    
  48.         [3'0-9'#
  49.         [@'-)'#
  50.     [)
  51.     [3'0-9'#
  52.     ['-'$
  53.     [4'0-9'#
  54.  
  55. This (might) be expressed as the following RE:
  56.  
  57.     (\(?[0-9]{3}[-)]?)?[0-9]{3}-[0-9]{4}
  58.         
  59. (Yes, yes, what a nightmare!)
  60.  
  61. A more robust rule would be required to scan a string for a person's
  62. name, but using LPM, it can be done.  (For example, I have a program
  63. that uses LPM to find nouns in a text file based upon their context
  64. within a sentence.)
  65.  
  66. If you'd like more information on LPM, just email me.
  67.  
  68.  
  69. Cheers,
  70.  
  71.  
  72.  
  73.  
  74. --                           
  75.                            | 
  76.     Parsepolis Software    |   Quinn Tyler Jackson
  77.         "ParseCity"        |     (aka 'Jamshid')
  78. >--------------------------|   qjackson@direct.ca
  79.                            |---------------------->
  80.  
  81.